/*package com.utils.spring;

import com.jayway.restassured.RestAssured;
import com.jayway.restassured.http.ContentType;
import com.jayway.restassured.response.Header;
import com.jayway.restassured.response.Headers;
import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
import com.kyhd.cpa.server.CpaApp;

import org.apache.commons.lang.StringUtils;
import org.hamcrest.Matchers;
import org.junit.Before;
import org.junit.Rule;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.IntegrationTest;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.http.HttpStatus;
import org.springframework.test.annotation.Rollback;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;

import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;

import javax.transaction.Transactional;

import static com.jayway.restassured.RestAssured.given;

@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = { CpaApp.class })
@WebAppConfiguration
@IntegrationTest({ "server.port:8888" })
public class AbstractApiIntegrationTest {

    

    protected DateFormat dateFormat = new SimpleDateFormat("MMddHHmmss");


    @Rule
    public ExpectedException exception = ExpectedException.none();

    private int port = 8888;

    @Before
    public void setUp() throws IOException {
        RestAssured.port = this.port;
    }

    protected Headers makeHeaders(Map<String, String> map) {
        List<Header> list = new ArrayList<Header>();

        for (String _key : map.keySet()) {
            Header header = new Header(_key, map.get(_key));
            list.add(header);
        }

        return new Headers(list);
    }

    

    protected void makeTest(String url, Headers headers, ContentType contentType, HttpStatus httpStatus, String content) {
        contentType = contentType == null ? ContentType.ANY : contentType;
        RequestSpecification req = given().contentType(contentType).headers(headers);

        ResponseSpecification res = req.expect().statusCode(httpStatus.value());
        if (StringUtils.isNotBlank(content)) {
            res.expect().content(Matchers.containsString(content));
        }
        res.when().get(url);
    }

    protected void makeTest(String url, Headers headers, ContentType contentType, HttpStatus httpStatus,
            String content, Map<String, String> pathParams) {
        contentType = contentType == null ? ContentType.ANY : contentType;
        RequestSpecification req = given().contentType(contentType).headers(headers).parameters(pathParams);

        ResponseSpecification res = req.expect().statusCode(httpStatus.value());
        if (StringUtils.isNotBlank(content)) {
            res.expect().content(Matchers.containsString(content));
        }
        res.when().get(url);
    }
}
*/